<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/5
 * Time: 19:08
 */

namespace Admin\Model;


use Think\Model;

/**
 * Class AuthGroupModel
 * @package Admin\Model
 * 权限组管理
 */
class AuthGroupModel  extends Model
{
    protected $pk='id';
    protected $tableName='auth_group';
    protected $_validate=[
        ['title','require','请填写权限组名称'],
        ['rules','require','请选择权限']
    ];
    /**
     * 权限组添加,编辑
     */
    public function addgroup($data){
//        dd($data);die;
       if($this->create($data)){
           if($data['id']){
               $this->save($data);
           }else{
               $this->add($data);
           }
           return ['valid'=>1,'msg'=>'操作成功'];
       }else{
           return ['valid'=>0,'msg'=>$this->getError()];
       }
    }

}